@layout("/common/_container.html"){


<script type="text/javascript">
    $(function () {
        var index = parent.layer.getFrameIndex(window.name); //获取窗口索引

        $("#btn_close").bind("click", function () {
            parent.layer.close(index);
        });

        $("#btn_save").bind("click", function () {
            var ids = Feng.zTreeCheckedNodes("zTree");
            var ajax = new $ax(Feng.ctxPath + "/channel/updatechanneldata", function (data) {
                Feng.success("隐藏设置成功!");
                window.parent.OrderChannel.table.refresh();
                parent.layer.close(index);
            }, function (data) {
                Feng.error("隐藏设置失败!"
                    + data.responseJSON.message + "!");
            });
            ajax.set("id", "${id}");
            ajax.set("ids", ids);
            if(document.getElementById("creditbutton").checked){
                ajax.set("creditbutton", $("#creditbutton").val());
            }
            if(document.getElementById("bannerbutton").checked){
                ajax.set("bannerbutton", $("#bannerbutton").val());
            }
            if(document.getElementById("loanbutton").checked){
                ajax.set("loanbutton", $("#loanbutton").val());
            }
            ajax.start();
        });

        initZtree();
    });

    function initZtree() {
        var setting = {
            check: {
                enable: true,
                chkboxType: { "Y": "ps", "N": "ps" }
            },
            data: {
                simpleData: {
                    enable: true
                }
            }
        };

        var ztree = new $ZTree("zTree", "/channel/menuTreeListBychannelId");
        ztree.setSettings(setting);
        ztree.init();
    }
</script>


<!-- 配置grid -->
<div class="container" style="padding:  0px 10px !important;margin-top: -10px;text-align: center !important;">
    <div class="row">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5>${roleName!}</h5>
            </div>
            <div class="ibox-content">
                <ul id="zTree" class="ztree"></ul>
            </div>
        </div>
    </div>
    <div class="row">
        <form>
            信用卡取现按钮隐藏<input type="checkbox" name="creditbutton" value="0" id="creditbutton"><br>
            贷款按钮隐藏<input type="checkbox" name="loanbutton" value="0" id="loanbutton"><br>
            资讯,论坛banner隐藏<input type="checkbox" name="bannerbutton" value="0" id="bannerbutton"><br>
        </form>
    </div>
    <div class="row">
        <div class="col-md-12">
            <button class="btn btn-sm btn-info" type="button" id="btn_save">
                <i class="ace-icon fa fa-check bigger-110"></i>保存
            </button>
            &nbsp;
            <button class="btn btn-sm btn-danger" type="button" id="btn_close">
                <i class="ace-icon fa fa-close bigger-110"></i>关闭
            </button>
        </div>
    </div>
</div>
@}
